package com.shangyueshang.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shangyueshang.model.SysUser;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

/**
 * @author JokeyFeng
 * @date: 2022/1/3
 * @project: shangyueshang
 * @package: com.shangyueshang.mapper
 * @comment:
 */
@Component
public interface SysUserMapper extends BaseMapper<SysUser> {
	
	/**
	 * 查询用户信息
	 *
	 * @param name
	 * @return
	 *
	 * @link https://blog.csdn.net/qq_35098526/article/details/117912886
	 */
	@ResultMap("mybatis-plus_SysUser")
	@Select("SELECT su.*, sd.name AS deptName FROM sys_user su LEFT JOIN sys_dept sd ON su.dept_id = sd.id WHERE su.name=#{name}")
	SysUser find(String name);
	
}
